package com.wangzh.concurrent.lock.function;

import java.util.function.Function;
import java.util.function.Predicate;

public class Demo {
    public static void main(String[] args) {

        Function<String,User> function =new Function<String, User>() {
            @Override
            public User apply(String s) {
                User user = new User();
                user.setName(s);
                return user;
            }
        };

        User asdb = function.apply("asdb");
        System.out.println(asdb);
        System.out.println("=============");
        Function<User,String> function1 = user -> user.getName();
        String apply = function1.apply(asdb);
        System.out.println(apply);

        System.out.println("=============");
        Predicate<String> p = new Predicate<String>(){
            @Override
            public boolean test(String s) {
                return s.isEmpty();
            }

        };
        Predicate<String> p2 = new Predicate<String>(){
            @Override
            public boolean test(String s) {
                return !s.isEmpty();
            }
        };
        Predicate<String> and = p2.and(p2);
        System.out.println(and.test("AA"));

    }
}
